var api = require('../../utils/api');
var utils = require('../../utils/utils');

Page({
    data: {
        orders: [], // 当前条件订单列表
    },
    onLoad: function (options) {
        var symbol = options.symbol;
        this.loadOrders(symbol);
        wx.showLoading({
            title: '正在加载'
        })
    },
    loadOrders: function (symbol) {
        // console.log(this.data.pair);
        api.getOrders({
            symbol: symbol,
            // states: 'filled,canceled,partial_canceled' // 'submitted,partial_filled'
            states: 'filled,partial_canceled'
        }).then(orders => {
            wx.hideLoading()
            this.setData({
                orders: utils.formatOrders(orders)
            });
        });
    },
})